package com.ruoyi.task;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

/**
 * 资产相关任务
 */
@Component("assetTask")
public class AssetTask {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    /**
     * 清空删除的资产
     */
    public void clean(){
        jdbcTemplate.execute("delete from asset_info where del_flag='0'");
        jdbcTemplate.execute("delete from asset_in_out where asset_id not in (select id from asset_info)");
        jdbcTemplate.execute("delete from asset_maintain where asset_id not in (select id from asset_info)");
        jdbcTemplate.execute("delete from asset_flow where asset_id not in (select id from asset_info)");
        jdbcTemplate.execute("delete from asset_flow_check where flow_id not in (select id from asset_flow)");
    }
}
